﻿@model Phatent.Model.Functions.MeetingModel


<div class="GeneralEdit" id="fmMeeting">
    <ul>
        <li>
            <label for="txtTitle">标题：</label>
            <input type="text" class="k-textbox" id="txtTitle" name="title" value="@Model.Title" required />
            <span class="k-invalid-msg" data-for="txtTitle"></span>
        </li>
        <li>
            <label for="txtTitle">主持人密码：</label>
            <input type="text" class="k-textbox" id="txtAdminPassword" name="adminPassword" value="@Model.AdminPassword" pattern=".{2,}" required validationMessage="请输入主持人密码" />
            <span class="k-invalid-msg" data-for="txtAdminPassword"></span>
        </li>
        <li>
            <label for="txtTitle">参与者密码：</label>
            <input type="text" class="k-textbox" id="txtJoinPassword" name="adminPassword" value="@Model.JoinPassword" pattern=".{2,}" required validationMessage="请输入主持人密码" />
            <span class="k-invalid-msg" data-for="txtJoinPassword"></span>
        </li>
        <li class="editButtons">
            <button id="btnSaveMeeting" class="k-button"><span class="k-icon k-i-tick"></span><span>确认提交</span></button>
            &nbsp;&nbsp;
            <button class="k-button" onclick="CancelGeneralEdit();"><span class="k-icon k-i-cancel"></span><span>&nbsp;返&nbsp;回</span></button>
        </li>
    </ul>
</div>

<script class="save_meeting">
    $(function () {
        var validator = $("#fmMeeting").kendoValidator().data("kendoValidator");
        $("#btnSaveMeeting").click(function (e) {
            if (validator.validate()) {
                var values = {
                    id: "@Model.ID",
                    title: $("#txtTitle").val(),
                    adminPassword: $("#txtAdminPassword").val(),
                    joinPassword: $("#txtJoinPassword").val(),
                };

                $.ajax({
                    url: "http://202.96.127.165/3m/meeting/manageIMeeting.do?meeting.meetingNumber=66128705&meeting.meetingKey=vOjQ64GCkdxTWfN5BzEvlZXBDcSVegx2&meeting.meetingStatus=1&meeting.meetingName=Net-Meeting&meeting.beginTime=2014-7-1 1:1:1&meeting.endTime=2015-7-1 1:1:1&meeting.meetingType=2&meeting.hostKey=" + $("#txtAdminPassword").val() + "&meeting.presenterKey=" + $("#txtAdminPassword").val() + "&meeting.assistantKey=" + $("#txtAdminPassword").val() + "&meeting.partcKey=" + $("#txtJoinPassword").val(),
                    dataType: "jsonp",
                    success: function (data) {
                        if (data.flag) {
                            Whale.Remote.Operation({
                                url: "/Admin/Fun/SaveMeeting",
                                parameters: values,
                                success: function (result) {
                                    wndGeneralEdit.close();
                                    if ($("#grid_meeting").length > 0)
                                        $("#grid_meeting").data("kendoGrid").dataSource.read();
                                },
                                error: function (msg) {
                                    wndGeneralInformation.content(msg).open();
                                }
                            });
                        }else
                            wndGeneralInformation.content("修改会议失败，远程服务器错误。").open();
                    }
                });
            }
            return false;
        });
    });
</script>
